<template>
	<view>
		<view class="re_top">
			<uni-datetime-picker v-model="range" type="daterange" @change="maskClick" />
			<view class="select">
				<view class="t1" @click="open">
					{{lable}}
					<uni-icons type="down"></uni-icons>
				</view>
				<view class="posa" v-if="isopen">
					<view :style="{color:item.lable==lable?'#000':''}" @click="change(item)" v-for="(item,index) in ulist" :key="index">
						{{item.lable}}
					</view>
				</view>
			</view>
		</view>
		<view class="ulist">
			<view class="items" v-for="(item,index) in List" :key="index">
				<image src="../../static/icon/tx.png" mode=""></image>
				<view class="flex_r">
					<view class="flex">
						<view class="t1">提现</view>
						<view class="t2">-{{item.amount}}</view>
					</view>
					<view class="flex">
						<view class="t3">{{item.createTime}}</view>
						<view class="t4" v-if="item.state == 'DRAW.ACCEPTED'">已受理</view>
						<view class="t4" v-else-if="item.state == 'DRAW.PROCESSING'">处理中</view>
						<view class="t4" v-else-if="item.state == 'DRAW.SUCCESS'">成功</view>
						<view class="t4" v-else-if="item.state == 'DRAW.FAILED'">失败</view>
					</view>
				</view>
			</view>
		</view>
		<view class="" style="height: 100rpx;">
			
		</view>
		<view class="kong" v-if="nolist">
			<view class="">
				<image src="/static/user/k.png" mode=""></image>
				<view class="ts">
					尚无数据
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		drawList
	} from '@/common/http.api.js';
	export default {
		data() {
			return {
				isopen:false,
				range: ['', ''],
				lable: '全部',
				ulist: [
					{
						lable: '全部',
						value: 0,
						state:''
					},
					{
						lable: '已受理',
						value: 0,
						state:'DRAW.ACCEPTED'
					},
					{
						lable: '处理中',
						value: 0,
						state:'DRAW.PROCESSING'
					},
					{
						lable: '成功',
						value: 0,
						state:'DRAW.SUCCESS'
					},
					{
						lable: '失败',
						value: 0,
						state:'DRAW.FAILED'
					}
				],
				params:{
					pageNum: 1,
					pageSize: 15,
					createTimeBegin:'',
					createTimeEnd:'',
					state:''
				},
				List:[],
				nolist:false
			};
		},
		onLoad() {
			this.getList()
		},
		onReachBottom() {
			this.params.pageNum++
			this.getList()
		},
		methods:{
			getList(){
				drawList(this.params).then(res=>{
					console.log(res);
					this.List.push(...res.rows)
					let total = Math.ceil(res.total / this.params.pageSize);
					this.nolist = total == 0
				})
			},
			maskClick(e){
				console.log(e);
				this.params.pageNum = 1
				this.params.createTimeBegin = e[0]
				this.params.createTimeEnd = e[1]
				this.List = []
				this.getList()
			},
			change(item) {
				this.lable = item.lable
				this.isopen = false
				this.params.pageNum = 1
				this.List = []
				this.params.state = item.state
				this.getList()
			},
			open() {
				this.isopen = !this.isopen
			}
		}
	}
</script>

<style lang="scss">
	.kong {
		width: 100%;
		margin: 230rpx auto;
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
	
		image {
			width: 228rpx;
			height: 228rpx;
		}
	
		.ts {
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: #000000;
			margin-top: 20rpx;
		}
	}
.re_top{
	display: flex;
	padding: 20rpx;
	box-sizing: border-box;
	align-items: center;
	position: sticky;
	background: #FFFFFF;
	top: 0%;
	.select{
		width: 130rpx;
		margin-left: 60rpx;
		position: relative;
		.t1 {
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 28rpx;
			color: #000000;
			display: flex;
			justify-content: space-between;
		}
		.posa {
			position: absolute;
			width: 130rpx;
			padding: 20rpx 0rpx;
			text-align: center;
			background: #FFFFFF;
			left: 0;
			top: 60rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 28rpx;
			color: #979797;
			line-height: 50rpx;
			box-sizing: border-box;
			box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.25);
		}
		
	}
}
.ulist{
	padding: 0rpx 20rpx;
	box-sizing: border-box;
	.items{
		display: flex;
		align-items: center;
		border-bottom: 1px solid #eee;
		padding-bottom: 20rpx;
		margin: 20rpx auto;
		image{
			width: 80rpx;
			height: 80rpx;
		}
		.flex_r{
			flex: 1;
			margin-left: 15rpx;
		}
		.flex{
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-family: PingFang SC, PingFang SC;
			.t1{
				font-weight: bold;
				font-size: 32rpx;
				color: #000000;
			}
			.t2{
				font-family:'DINB';
				font-size: 40rpx;
				color: #000000;
			}
			.t3{
				font-weight: 500;
				font-size: 28rpx;
				color: #979797;
			}
			.t4{
				font-weight: 500;
				font-size: 24rpx;
				color: #CE7034;
			}
			
		}
	}
}
</style>
